<html> 
    <head> 
        <title>Demo</title> 
        <script src="/socket.io/socket.io.js"></script>
        <script src="js/jquery.min.js"></script>
		<script>
		  var socket = io.connect('http://localhost');
		  socket.on('connect', function () {
			  send('login',{user:'hule'});
		  });
		  socket.on('news', function (data) {
		    console.log(data);
		    socket.emit('my other event', { my: 'data' });
		  });
		  socket.on('message', function (msg) {
		     alert(msg);
		  });
		  function send(type,ms){
			  var msg={};
			  msg.type=type;
			  msg.msg=ms;
			  socket.send(JSON.stringify(msg));
		  }
		</script>
    </head> 
    <body> 
        <input type="text" id="content" /><input type="button" id="send" value="send" onclick="javascript:send()"/>
        <input onclick="startRecording()" type="button" id="bt" value="start" />
    </body> 
</html> 